home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # mount-all-images
- # copyleft (c) 2000, joseph cheek, joseph@cheek.com. released under GPL.
- #
- # mount-all-images:
- # mount all of the (cd, floppy, ramdisk) images from a build in the
- # specified directory.
- #
- # ex: ./mount-all-images
- #
-
- LANG=
-
- MNT="/opt/redmondlinux/builds/mnt"
-
- BUILD_NUM_FILE=/opt/redmondlinux/builds/CURRENT_BUILD
- BUILD_NUM=`cat $BUILD_NUM_FILE`
-
- if [ "n$1" = "n-l" ]; then # -l
- LANG="$2"
- shift
- shift
- fi
-
- if [ -z "$LANG" ]; then
- echo -e `basename $0` \[-l lang\]: need lang \\a
- exit 1
- fi
-
- BUILD_BASE=/opt/redmondlinux/builds/$BUILD_NUM/$LANG
-
-
- #
- #
- # first, make the mount points, if necessary
-
- mkdir -p "$MNT"/{{cd,install}{,_ramdisk,_ramdisk.new},scsi,pcmcia{,.new}}
-
- # remove immutable bits
-
- chattr -i /tmp/initrd*
-
- # and make backup copies of the images
-
- cp "$BUILD_BASE"/{boot/cdboot.288,floppy/*.144} /tmp
-
- # mount ext2 files under loopback
-
- mount -o loop "$BUILD_BASE"/boot/cdboot.288 "$MNT"/cd ||
- echo -e cd mount failed\\a
-
- mount -o loop "$BUILD_BASE"/floppy/install.144 "$MNT"/install ||
- echo -e install mount failed\\a
-
- mount -o loop "$BUILD_BASE"/floppy/scsi.144 "$MNT"/scsi ||
- echo -e scsi mount failed\\a
-
- mount -o loop "$BUILD_BASE"/floppy/pcmcia.144 "$MNT"/pcmcia ||
- echo -e pcmcia mount failed\\a
-
-
- #
- #
- # mount initrd images from cd and install
-
- # first, uncompress the images
- zcat "$MNT"/cd/initrd.gz > /tmp/initrd.cd
- zcat "$MNT"/install/initrd.gz > /tmp/initrd.install
-
- # and make backups
- cp /tmp/initrd.cd{,.orig}
- cp /tmp/initrd.install{,.orig}
-
- # and remove the originals to save space
- # rm "$MNT"/cd/initrd.gz
- # rm "$MNT"/install/initrd.gz
-
- # then mount the originals
- mount -o loop /tmp/initrd.cd "$MNT"/cd_ramdisk ||
- echo -e cd_ramdisk mount failed\\a
-
- mount -o loop /tmp/initrd.install "$MNT"/install_ramdisk ||
- echo -e install_ramdisk mount failed\\a
-
- # then make them immutable so they don't [accidentally or maliciously]
- # get destroyed [BUG: assumes ext2 filesystem]
- #
- # fortunately [?] we can still write to the loopback-mounted filesystem
- # with the immutable bit set
- #
- # we must mount them before we make them immutable tho
- chattr +i /tmp/initrd.{cd,install}
-
- # show mounts
-
- df -k
-